{block name="main"}

        <!-- page -->

        <form class="form-horizontal pt-15 widthFixedForm">
            <div class="form-group">
                <label class="col-md-2 control-label">是否开启</label>
                <div class="col-md-5">
                    <div class="switch-inline">
                        <input type="checkbox" id="is_use" {if $is_use==1}checked{/if}>
                        <label for="is_use" class=""></label>
                    </div>
                </div>
            </div>
            <div class="form-group"></div>
            <div class="form-group">
                <label class="col-md-2 control-label"></label>
                <div class="col-md-8">
                    <button class="btn btn-primary save" id="save" type="button">保存</button>
                    <a href="javascript:history.go(-1);" class="btn btn-default">返回</a>
                </div>
            </div>
        </form>

        <!-- page end -->

{/block}
{block name="script"}
<script>
    require(['util'],function(util){
        $("#save").on("click",function () {
            var val;
            if($("#is_use").is(':checked')) {
                val = 1;
            }
            else{
                val = 0;
            }
            $.ajax({
                type:'POST',
                dataType:'json',
                url:'{$setConfigUrl}',
                data:{
                    'is_use':val
                },
                success:function (data) {
                    if (data['code'] > 0) {
                        util.message(data["message"], 'success', "{:__URL('ADDONS_MAINfullCutSet')}");
                    } else {
                        util.message(data["message"], 'danger');
                    }
                }
            });
        })

    })
</script>
{/block}
